﻿<div class="top-row ps-3 navbar navbar-dark">
    <div class="container-fluid">
        <a class="navbar-brand" href="">WebFile</a>

        <div class="navbar-toggler" @onclick="ToggleNavMenu">
            <span class="navbar-toggler-icon"></span>
        </div>

    </div>
</div>

<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
    <nav class="flex-column">
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
                <i class="fa-solid fa-house" aria-hidden="true"> 主页</i>
            </NavLink>
        </div>
        <AuthorizeView>
            <Authorized>
                <div class="nav-item px-3">
                    <NavLink class="nav-link" href="/AllFile" Match="NavLinkMatch.All">
                        <i class="fa-solid fa-folder-open" aria-hidden="true"> 全部文件</i>
                    </NavLink>
                </div>
                <div class="nav-item px-3">
                    <NavLink class="nav-link" href="/Account" Match="NavLinkMatch.All">
                        <i class="fa-solid fa-user" aria-hidden="true"> 我的</i>
                    </NavLink>
                </div>
                <div class="nav-item px-3">
                    <NavLink class="nav-link" href="/Account/Setting" Match="NavLinkMatch.All">
                        <i class="fa-solid fa-gear" aria-hidden="true"> 用户设置</i>
                    </NavLink>
                </div>
            </Authorized>
        </AuthorizeView>
        @* <div class="nav-item px-3"> *@
        @*     <NavLink class="nav-link" href="counter"> *@
        @*         <span class="oi oi-plus" aria-hidden="true"></span> Counter *@
        @*     </NavLink> *@
        @* </div> *@
        @* <div class="nav-item px-3"> *@
        @*     <NavLink class="nav-link" href="fetchdata"> *@
        @*         <span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data *@
        @*     </NavLink> *@
        @* </div> *@
    </nav>
</div>

@code {
    private bool collapseNavMenu = true;

    private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;

    private void ToggleNavMenu()
    {
        collapseNavMenu = !collapseNavMenu;
    }

}

<style>
    .nav-link{
        padding: 10px;
    }
</style>